package com.cyzy.mapper;

import com.cyzy.entity.Curriculum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ScheduleMapper {

    @Select("SELECT id, teacher_id as teacherId, teacher_name as teacherName, class_id as classId, weekday, time_period as timePeriod, course_name as courseName, create_time as createTime, update_time as updateTime FROM teacher_available_time WHERE class_id = #{classId}")
    List<Curriculum> getScheduleByClassId(Integer classId);

    @Select("SELECT id, teacher_id as teacherId, teacher_name as teacherName, class_id as classId, weekday, time_period as timePeriod, course_name as courseName, create_time as createTime, update_time as updateTime FROM teacher_available_time WHERE class_id = #{classId} AND weekday = #{weekday}")
    List<Curriculum> getScheduleByClassIdAndWeekday(Integer classId, Integer weekday);
    //传入星期几数字和上下午1/2判断是否有课
    @Select("SELECT id, teacher_id as teacherId, teacher_name as teacherName, class_id as classId, weekday, time_period as timePeriod, course_name as courseName, create_time as createTime, update_time as updateTime FROM teacher_available_time WHERE class_id = #{classId} AND weekday = #{weekday} AND time_period = #{timePeriod}")
    List<Curriculum> getScheduleByClassIdAndWeekdayAndTimePeriod(Integer classId, Integer weekday, Integer timePeriod);
}
